/**
 * Client entry point
 */
import React, {Fragment} from 'react';
import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import App from './App';
import { configureStore } from './store';
import {GlobalStyle} from "./util/style";
import { Iconfont } from './static/iconfont/iconfont'
import {fromJS} from "immutable";
import axios from "axios"
import { baseUrl } from "./config/config"
// Initialize store
const store = configureStore(fromJS({}));
const mountApp = document.getElementById('root');
axios.defaults.baseURL = baseUrl
render(
  <AppContainer>
    <Fragment>
      <App store={store} />
      <GlobalStyle/>
      <Iconfont/>
    </Fragment>
  </AppContainer>,
  mountApp
);

// For hot reloading of react components
if (module.hot) {
  module.hot.accept('./App', () => {
    // If you use Webpack 2 in ES modules mode, you can
    // use <App /> here rather than require() a <NextApp />.
    const NextApp = require('./App').default; // eslint-disable-line global-require
    render(
      <AppContainer>
        <NextApp store={store} />
      </AppContainer>,
      mountApp
    );
  });
}
